package com.mallcloud.mall.app.controller;

import com.mallcloud.mall.app.service.AppParkingCouponService;
import com.mallcloud.mall.common.core.util.R;
import com.mallcloud.mall.mall.api.entity.dto.ParkingPointsPayDiscount;
import com.mallcloud.mall.mall.api.entity.dto.ProParkingCouponWriteOff;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "app-停车券接口")
@RestController
@AllArgsConstructor
@RequestMapping("/app/parkingCoupon")
public class AppParkingCouponController {
    private final AppParkingCouponService appParkingCouponService;

	@ApiOperation("停车券-核销")
	@PostMapping("/writeOff")
	public R ParkingPayCoupon(@RequestBody ProParkingCouponWriteOff entity) {
		appParkingCouponService.parkingCouponWriteOff(entity);
		return R.ok();
	}

    @ApiOperation("停车券-核销冲正")
    @PostMapping("/reversal")
    public R ParkingPayCouponReversal(ProParkingCouponWriteOff entity) {
		appParkingCouponService.parkingCouponReversal(entity);
        return R.ok();
    }

	@ApiOperation("停车积分-抵扣费")
	@PostMapping("/discount")
	public R payPoint(ParkingPointsPayDiscount entity) {
		appParkingCouponService.parkingPointsDiscount(entity);
		return R.ok();
	}

    @ApiOperation("停车积分-抵扣费冲正")
    @PostMapping("/discountReversal")
    public R payPointCz(ParkingPointsPayDiscount entity) {
		appParkingCouponService.parkingPointsDiscountReversal(entity);
        return R.ok();
    }

}
